﻿using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Web;
using System.Web.Security;
using System.Web.Core;
using System;

namespace Yuanlin.Business
{
    public class YuanlinUser : User
    {
        #region Private Members

        private Property<string> nickName = new Property<string>();
        private Property<string> realName = new Property<string>();
        private string password = null;
        private Property<string> companyEmail = new Property<string>();
        private Property<string> identityCardNumber = new Property<string>();
        private Property<string> companyPostCode = new Property<string>();
        private Property<string> passwordProtectionNumber = new Property<string>();
        private Property<string> companyQQ = new Property<string>();
        private Property<string> companyMSN = new Property<string>();
        private Property<string> companyName = new Property<string>();
        private Property<string> companyContactPhone = new Property<string>();
        private Property<string> companySite = new Property<string>();
        private Property<string> companyAddress = new Property<string>();
        private Property<string> companyTypes = new Property<string>();
        private Property<int> province = new Property<int>();
        private Property<int> city = new Property<int>();
        private Property<int> town = new Property<int>();
        private Property<int> smallTown = new Property<int>();
        private Property<int> totalVisitCount = new Property<int>();
        private Property<DateTime> lastLoginDate = new Property<DateTime>();
        private Property<DateTime> registerDate = new Property<DateTime>();
        private Property<int> userStatus = new Property<int>();
        private Property<string> companyDescription = new Property<string>();
        private Property<string> companyTemplate = new Property<string>();
        private Property<int> bankIndex = new Property<int>();
        private Property<string> bankAccount = new Property<string>();
        private Property<string> companyFaxNumber = new Property<string>();
        private Property<string> companyFixedTelephone1 = new Property<string>();
        private Property<string> companyFixedTelephone2 = new Property<string>();
        private Property<string> companyScale = new Property<string>();
        private Property<string> companyGoodSkill = new Property<string>();
        private Property<string> recommendedUser = new Property<string>();
        private Property<string> question1 = new Property<string>();
        private Property<string> question1Answer = new Property<string>();
        private Property<string> question2 = new Property<string>();
        private Property<string> question2Answer = new Property<string>();
        private Property<string> registerGreenNumber = new Property<string>();
        private Property<string> propertyNames = new Property<string>();
        private Property<string> propertyValues = new Property<string>();
        
        #endregion

        #region Contructors

        public YuanlinUser()
        {
            lastLoginDate.Value = DateTime.Now;
            registerDate.Value = DateTime.Now;
        }

        #endregion

        #region Public Properties

        public string CurrentGreenNumber
        {
            get
            {
                return CookieManager.GetCookieValue("MemberName", null);
            }
        }

        public Property<string> NickName
        {
            get
            {
                return nickName;
            }
            set
            {
                nickName = value;
            }
        }
        public Property<string> RealName
        {
            get
            {
                return realName;
            }
            set
            {
                realName = value;
            }
        }
        public string Password
        {
            get
            {
                return password;
            }
            set
            {
                password = value;
            }
        }
        public Property<string> CompanyEmail
        {
            get
            {
                return companyEmail;
            }
            set
            {
                companyEmail = value;
            }
        }
        public Property<string> IdentityCardNumber
        {
            get
            {
                return identityCardNumber;
            }
            set
            {
                identityCardNumber = value;
            }
        }
        public Property<string> CompanyPostCode
        {
            get
            {
                return companyPostCode;
            }
            set
            {
                companyPostCode = value;
            }
        }
        public Property<string> PasswordProtectionNumber
        {
            get
            {
                return passwordProtectionNumber;
            }
            set
            {
                passwordProtectionNumber = value;
            }
        }
        public Property<string> CompanyQQ
        {
            get
            {
                return companyQQ;
            }
            set
            {
                companyQQ = value;
            }
        }
        public Property<string> CompanyMSN
        {
            get
            {
                return companyMSN;
            }
            set
            {
                companyMSN = value;
            }
        }
        public Property<string> CompanyName
        {
            get
            {
                return companyName;
            }
            set
            {
                companyName = value;
            }
        }
        public Property<string> CompanyContactPhone
        {
            get
            {
                return companyContactPhone;
            }
            set
            {
                companyContactPhone = value;
            }
        }
        public Property<string> CompanySite
        {
            get
            {
                return companySite;
            }
            set
            {
                companySite = value;
            }
        }
        public Property<string> CompanyAddress
        {
            get
            {
                return companyAddress;
            }
            set
            {
                companyAddress = value;
            }
        }
        public Property<string> CompanyTypes
        {
            get
            {
                return companyTypes;
            }
            set
            {
                companyTypes = value;
            }
        }
        public Property<int> Province
        {
            get
            {
                return province;
            }
            set
            {
                province = value;
            }
        }
        public Property<int> City
        {
            get
            {
                return city;
            }
            set
            {
                city = value;
            }
        }
        public Property<int> Town
        {
            get
            {
                return town;
            }
            set
            {
                town = value;
            }
        }
        public Property<int> SmallTown
        {
            get
            {
                return smallTown;
            }
            set
            {
                smallTown = value;
            }
        }
        public Property<int> TotalVisitCount
        {
            get
            {
                return totalVisitCount;
            }
            set
            {
                totalVisitCount = value;
            }
        }
        public Property<DateTime> LastLoginDate
        {
            get
            {
                return lastLoginDate;
            }
            set
            {
                lastLoginDate = value;
            }
        }
        public Property<DateTime> RegisterDate
        {
            get
            {
                return registerDate;
            }
            set
            {
                registerDate = value;
            }
        }
        public Property<int> UserStatus
        {
            get
            {
                return userStatus;
            }
            set
            {
                userStatus = value;
            }
        }
        public Property<string> CompanyDescription
        {
            get
            {
                return companyDescription;
            }
            set
            {
                companyDescription = value;
            }
        }
        public Property<string> CompanyTemplate
        {
            get
            {
                return companyTemplate;
            }
            set
            {
                companyTemplate = value;
            }
        }
        public Property<int> BankIndex
        {
            get
            {
                return bankIndex;
            }
            set
            {
                bankIndex = value;
            }
        }
        public Property<string> BankAccount
        {
            get
            {
                return bankAccount;
            }
            set
            {
                bankAccount = value;
            }
        }
        public Property<string> CompanyFaxNumber
        {
            get
            {
                return companyFaxNumber;
            }
            set
            {
                companyFaxNumber = value;
            }
        }
        public Property<string> CompanyFixedTelephone1
        {
            get
            {
                return companyFixedTelephone1;
            }
            set
            {
                companyFixedTelephone1 = value;
            }
        }
        public Property<string> CompanyFixedTelephone2
        {
            get
            {
                return companyFixedTelephone2;
            }
            set
            {
                companyFixedTelephone2 = value;
            }
        }
        public Property<string> CompanyScale
        {
            get
            {
                return companyScale;
            }
            set
            {
                companyScale = value;
            }
        }
        public Property<string> CompanyGoodSkill
        {
            get
            {
                return companyGoodSkill;
            }
            set
            {
                companyGoodSkill = value;
            }
        }
        public Property<string> RecommendedUser
        {
            get
            {
                return recommendedUser;
            }
            set
            {
                recommendedUser = value;
            }
        }
        public Property<string> Question1
        {
            get
            {
                return question1;
            }
            set
            {
                question1 = value;
            }
        }
        public Property<string> Question1Answer
        {
            get
            {
                return question1Answer;
            }
            set
            {
                question1Answer = value;
            }
        }
        public Property<string> Question2
        {
            get
            {
                return question2;
            }
            set
            {
                question2 = value;
            }
        }
        public Property<string> Question2Answer
        {
            get
            {
                return question2Answer;
            }
            set
            {
                question2Answer = value;
            }
        }
        public Property<string> RegisterGreenNumber
        {
            get
            {
                return registerGreenNumber;
            }
            set
            {
                registerGreenNumber = value;
            }
        }
        public Property<string> PropertyNames
        {
            get
            {
                return propertyNames;
            }
            set
            {
                propertyNames = value;
                OnExtendedAttributesDataChanged();
            }
        }
        public Property<string> PropertyValues
        {
            get
            {
                return propertyValues;
            }
            set
            {
                propertyValues = value;
                OnExtendedAttributesDataChanged();
            }
        }

        #endregion

        #region 对应前台公司的菜单

        public string Huamu
        {
            get
            {
                return ExtendedAttributes.GetValue("Huamu");
            }
            set
            {
                ExtendedAttributes.SetValue("Huamu", value);
                RefreshExtendedAttributes();
            }
        }
        public string Huamujingpin
        {
            get
            {
                return ExtendedAttributes.GetValue("Huamujingpin");
            }
            set
            {
                ExtendedAttributes.SetValue("Huamujingpin", value);
                RefreshExtendedAttributes();
            }
        }
        public string Huamuqiugou
        {
            get
            {
                return ExtendedAttributes.GetValue("Huamuqiugou");
            }
            set
            {
                ExtendedAttributes.SetValue("Huamuqiugou", value);
                RefreshExtendedAttributes();
            }
        }
        public string Huamujishou
        {
            get
            {
                return ExtendedAttributes.GetValue("Huamujishou");
            }
            set
            {
                ExtendedAttributes.SetValue("Huamujishou", value);
                RefreshExtendedAttributes();
            }
        }
        public string Fishery
        {
            get
            {
                return ExtendedAttributes.GetValue("Fishery");
            }
            set
            {
                ExtendedAttributes.SetValue("Fishery", value);
                RefreshExtendedAttributes();
            }
        }
        public string FisheryJingPin
        {
            get
            {
                return ExtendedAttributes.GetValue("FisheryJingPin");
            }
            set
            {
                ExtendedAttributes.SetValue("FisheryJingPin", value);
                RefreshExtendedAttributes();
            }
        }
        public string FisheryQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("FisheryQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("FisheryQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string FisheryJiShou
        {
            get
            {
                return ExtendedAttributes.GetValue("FisheryJiShou");
            }
            set
            {
                ExtendedAttributes.SetValue("FisheryJiShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string Business
        {
            get
            {
                return ExtendedAttributes.GetValue("Business");
            }
            set
            {
                ExtendedAttributes.SetValue("Business", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyNews
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyNews");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyNews", value);
                RefreshExtendedAttributes();
            }
        }
        public string Certificate
        {
            get
            {
                return ExtendedAttributes.GetValue("Certificate");
            }
            set
            {
                ExtendedAttributes.SetValue("Certificate", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyShop
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyShop");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyShop", value);
                RefreshExtendedAttributes();
            }
        }
        public string MyShopping
        {
            get
            {
                return ExtendedAttributes.GetValue("MyShopping");
            }
            set
            {
                ExtendedAttributes.SetValue("MyShopping", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyBrand
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyBrand");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyBrand", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyRecruit
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyRecruit");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyRecruit", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyAlbum
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyAlbum");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyAlbum", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyTechnology
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyTechnology");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyTechnology", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyProjectPerformance
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyProjectPerformance");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyProjectPerformance", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyProject
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyProject");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyProject", value);
                RefreshExtendedAttributes();
            }
        }
        public string SendMessage
        {
            get
            {
                return ExtendedAttributes.GetValue("SendMessage");
            }
            set
            {
                ExtendedAttributes.SetValue("SendMessage", value);
                RefreshExtendedAttributes();
            }
        }
        public string ContactInfo
        {
            get
            {
                return ExtendedAttributes.GetValue("ContactInfo");
            }
            set
            {
                ExtendedAttributes.SetValue("ContactInfo", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyMachineChuShou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyMachineChuShou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyMachineChuShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyMachineQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyMachineQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyMachineQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyFacilityChuShou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyFacilityChuShou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyFacilityChuShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyFacilityQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyFacilityQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyFacilityQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyAgriculturalChuShou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyAgriculturalChuShou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyAgriculturalChuShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyAgriculturalQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyAgriculturalQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyAgriculturalQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyHuaFeiChuShou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyHuaFeiChuShou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyHuaFeiChuShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyHuaFeiQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyHuaFeiQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyHuaFeiQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyMashChuShou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyMashChuShou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyMashChuShou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyMashQiuGou
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyMashQiuGou");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyMashQiuGou", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyPartner
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyPartner");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyPartner", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyFriend
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyFriend");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyFriend", value);
                RefreshExtendedAttributes();
            }
        }
        public string CompanyMash
        {
            get
            {
                return ExtendedAttributes.GetValue("CompanyMash");
            }
            set
            {
                ExtendedAttributes.SetValue("CompanyMash", value);
                RefreshExtendedAttributes();
            }
        }
        public string Crop
        {
            get
            {
                return ExtendedAttributes.GetValue("Crop");
            }
            set
            {
                ExtendedAttributes.SetValue("Crop", value);
                RefreshExtendedAttributes();
            }
        }
        public string Cropjingpin
        {
            get
            {
                return ExtendedAttributes.GetValue("Cropjingpin");
            }
            set
            {
                ExtendedAttributes.SetValue("Cropjingpin", value);
                RefreshExtendedAttributes();
            }
        }
        public string Cropqiugou
        {
            get
            {
                return ExtendedAttributes.GetValue("Cropqiugou");
            }
            set
            {
                ExtendedAttributes.SetValue("Cropqiugou", value);
                RefreshExtendedAttributes();
            }
        }
        public string Cropjishou
        {
            get
            {
                return ExtendedAttributes.GetValue("Cropjishou");
            }
            set
            {
                ExtendedAttributes.SetValue("Cropjishou", value);
                RefreshExtendedAttributes();
            }
        }

        #endregion

        #region Private Methods

        private void OnExtendedAttributesDataChanged()
        {
            if (!string.IsNullOrEmpty(PropertyNames.Value) && !string.IsNullOrEmpty(PropertyValues.Value))
            {
                SerializerData data = new SerializerData();
                data.Keys = PropertyNames.Value;
                data.Values = PropertyValues.Value;
                ExtendedAttributes.SetSerializerData(data);
            }
        }
        private void RefreshExtendedAttributes()
        {
            SerializerData data = ExtendedAttributes.GetSerializerData();
            this.PropertyNames.Value = data.Keys;
            this.PropertyValues.Value = data.Values;
        }

        #endregion
    }
}
